package com.cal.utms.action.payment;

import com.cal.utms.dto.payment.RedemptionDto;
import com.cal.utms.model.payment.RedemptionModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class RedemptionRequestAction extends ActionSupport implements ModelDriven<RedemptionDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private RedemptionDto redemptionDto = new RedemptionDto();
	private String redemDetails;
	private int redemption_id;

	RedemptionModel model = new RedemptionModel();

	public String saveRedemption() {
		model.saveRedemption(redemptionDto, redemDetails);
		return Action.SUCCESS;
	}

	public String updateRedempton() {
		model.update(redemptionDto, redemDetails, redemption_id);
		return Action.SUCCESS;
	}

	public String getRedemRequest() {
		redemptionDto.setSuccess(true);
		redemptionDto.setRedemptionDtos(model.getAllRequest());
		return Action.SUCCESS;
	}

	public String getConfirmedRedemRequest() {
		redemptionDto.setSuccess(true);
		redemptionDto.setRedemptionDtos(model.getConfirmedRedemptions());
		return Action.SUCCESS;
	}

	public String confirmRedemption() {
		model.confirmRedemption(redemptionDto, redemption_id);
		return Action.SUCCESS;
	}

	public String redemptioncancel() {
		model.cancelConfRedemtion(redemptionDto, redemption_id);
		return Action.SUCCESS;
	}

	@Override
	public RedemptionDto getModel() {
		return redemptionDto;
	}

	public RedemptionDto getRedemptionDto() {
		return redemptionDto;
	}

	public void setRedemptionDto(RedemptionDto redemptionDto) {
		this.redemptionDto = redemptionDto;
	}

	public String getRedemDetails() {
		return redemDetails;
	}

	public void setRedemDetails(String redemDetails) {
		this.redemDetails = redemDetails;
	}

	public int getRedemption_id() {
		return redemption_id;
	}

	public void setRedemption_id(int redemption_id) {
		this.redemption_id = redemption_id;
	}

}
